package com.zt.bigdata.elasticsearch.web.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * 短链接操作
 * Created by hzlizx on 2018/4/17 0017
 */
@RestController
@RequestMapping("/api")
public class ApiController {
    private static final Logger logger = LoggerFactory.getLogger(ApiController.class);


    /**
     * 分页获取短链接列表，需要登录。
     *
     * @param page 页码
     * @return 带页码信息的短链接列表
     */
    @GetMapping("/list")
    public ServiceResult list(@RequestParam int page) {
        return ServiceResult.ok(null);
    }

    @PostMapping("/search")
    public ServiceResult hcreate(@RequestBody ShortUrl shortUrl) {
        HashMap<String, String> map = new HashMap<>();
        map.put("longUrl", shortUrl.getLongUrl());
        map.put("code", "DAFDSFG");
        return ServiceResult.ok(map);
    }


}
